﻿$xl=New-Object -ComObject excel.application
$xl.visible=$true
$wb=$xl.workbooks.open("C:\Users\lwang52\Desktop\部门.xlsx")
$sheet=$wb.sheets.item(1)
$object=
for($i=1;$i -lt $sheet.range("a65536").end(-4162).row;$i++) #xlDown -4121 Down. xlToLeft -4159 To left. xlToRight -4161 To right. xlUp -4162 Up.
{
Write-Host $sheet.range("A$i").text #A列对应每行的值 A column correspond to per row value
}
 
$xl.displayAlerts=$False
$wb.Close()
$xl.Application.Quit()


add-type @"
    using System.Net;
    using System.Security.Cryptography.X509Certificates;
    public class TrustAllCertsPolicy : ICertificatePolicy {
        public bool CheckValidationResult(
            ServicePoint srvPoint, X509Certificate certificate,
            WebRequest request, int certificateProblem) {
            return true;
        }
    }
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
 
$result = Invoke-WebRequest -Uri "https://www.pstips.net"


$text = @"
  I am safe here
  I can even use "quotes"
"@
 
$text | Out-GridView


$text = {
  I am safe here
  I can even use "quotes"
}
 
$text.ToString() | Out-GridView

$text1 = "Some text with digits267686783"
$text2 = "Some text with digits3"
 
$text1 -replace "\d{0,5}$"
$text2 -replace "\d{0,5}$"